/**
 * @Description: 入口文件
 * @Author 卞鹏飞 <228443632@qq.com>
 * @create 2023/12/5 21:18
 */
import '@/style'
import { createApp } from 'vue' // vue
import App from './App.vue' // 根组件
import { createLazyRouter } from '@/components/base/RouterViewCache/utils'
import { createWebHashHistory } from 'vue-router'
import vueSeamless from 'vue-seamless-scroll/src'
import routes from '@/routes'
import { authRouterMiddleware } from '@/routesAuth'
import plugins from '@/plugins'
import store from '@/store'

// eslint-disable-next-line no-unused-vars
let app

function render() {
  app = createApp(App).use(store).use(plugins)
  const routeInstance = createLazyRouter({
    base: process.env.BASE_URL,
    history: createWebHashHistory(),
    routes
  })
  // 权限中间件
  authRouterMiddleware.call(routeInstance)

  app.use(routeInstance)
  app.use(vueSeamless)
  app.mount('#app')
}

render()
